// 接口用interface 描述接口的类型达到复用的目的
interface Person {
    name: string,
    age: number,
    sayHi(): void
}

let persons: Person = {
    name: "mortal",
    age: 18,
    sayHi() {

        console.log("hello mortal")
    }
}
persons.sayHi();

// 别名
type Person2 = {
    name: string,
    age: number,
    sayHi(): void
}
let sperson1: Person2 = {
    name: "mortal",
    age: 18,
    sayHi() {

        console.log("hello sean")
    }
}
sperson1.sayHi();

// 别名和接口类型的区别
// 接口只能为对象指定类型,别名可以为任意数据解构指定类型

// 接口继承
interface mortal {
    name: string,
    age: number
}

interface mortal1 extends mortal {
    address: string
}

const sean: mortal1 = {
    name: "sean",
    age: 18,
    address: "北京"
}



